import Crypto from 'crypto-js'

/**
 *
 * @param {string} str
 * @returns {Boolean}
 */
export function validUsername (str) {
  // for debug
  // test username field is legal
  return true
}

export function isExternal (path) {
  return /^(https?:\/\/|mailto:|tel:|http:\/\/)/.test(path)
}

export function md5 (preStr) {
  return Crypto.MD5(preStr).toString()
}
